<!--
# coding=UTF-8
# Copyright (c) 2025 Bird Software Solutions Ltd
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#    Neil Mackenzie - initial API and implementation
#    Benjamin Arfa - improvements
#
-->
{% extends 'base.html' %}

{% block content %}
<h1>Make Final Manual Edits to Generated Python Code</h1>

<p>
    <a href="{% url 'pybirdai:create_transformation_rules_in_python'%}">Back to the Create Python Transformation Rules from MetaData Page</a> <br><br>
    <b> description under construction</b><br><br>
    
    We then need to move the generated files to the correct locations<br><br>
    remove old files from birds_nest\pybirdai\process_steps\filter_code<br><br>
    The report_cells.py file form the birds_nest\results\generated_python_filters folder should be moved to the birds_nest\pybirdai\process_steps\filter_code folder.<br><br> 
    All generated python files from the birds_nest\results\generated_python_joins folder should be moved to the birds_nest\pybirdai\process_steps\filter_code folder.<br><br> 
    All generated html files from the birds_nest\results\generated_html  folder should be moved to the birds_nest\pybirdai\templates\pybirdai folder. Make sure to delete the old htlml files for these reports first if they exist, and  particularly the old reports_template.html file.<br><br>
    

    Although FreeBIRD Application generates about 95% of the code we need for generation rules, we need to complete the last 5% manually <br><br>
    This is because we have flexibility in how we define the Joins of tables on the input layer data <br><br>
    Do the edits to the generated python joins code as required <b>(This step is to be documented further)</b><br><br> 
    For now, as an example you can find the class  F_05_01_REF_FINREP_3_0_Other_loans_Table in  pybirdai/process_steps/filter_code/F_05_01_REF_FINREP_3_0_logic.py and replace it with the code   <a href="https://github.com/regcommunity/FreeBIRD/blob/main/birds_nest/pybirdai/process_steps/filter_code/F_05_01_REF_FINREP_3_0_logic.py#L527">here</a> <br><br>
    
    If we have not yet refined the joins metadata (see seperate tutorial), then you will need to manually fix the code where carrying amount is being created twice in some function defintions. To fix this for the Finrep F05.01 report you should find the  
    class Other_loans(F_05_01_REF_FINREP_3_0_Base): in pybirdai/process_steps/filter_code/F_05_01_REF_FINREP_3_0_logic.py and replace it with this class which has RPYMNT_RGHTS,MLTLTRL_DVLPMNT_BNK_INDCTR and NGTBL_SCRTY_INDCTR defaulted   <a href="https://github.com/regcommunity/FreeBIRD/blob/main/birds_nest/pybirdai/process_steps/filter_code/F_05_01_REF_FINREP_3_0_logic.py#L296">here</a> <br><br>
    
    This will allow you later to run the transformations for the  F05.01 report.<br><br>
    
    
</p>


{% endblock %}